import { createRouter, createWebHistory } from 'vue-router'

// import layout from '@/views/layout/index.vue'
import News from './modules/News'
import createNews from './modules/createNews'
import Permission from './modules/Permission'
import RoleList from './modules/RoleList'
import UserManage from './modules/UserManage'
// 私有化路由
const privateRoutes = [
  News,
  createNews,
  Permission,
  RoleList,
  UserManage
]

// 公有的路由
const publicRoutes = [
  {
    path: '/login',
    component: () => import('@/views/LoginPage.vue'),
  },
  {
    path: '/',
    // component: layout
    component: () => import('@/views/layout/index.vue')
  },{
    path: '/404',
    component: ()=>import('@/views/404Page.vue')
  },{
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  }
]
const router = createRouter({
  history: createWebHistory(),
  routes: [...publicRoutes, ...privateRoutes],
})

export default router
